using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;

namespace Commerce.Common
{
	/// <summary>
	/// Strongly-typed collection for the Product class.
	/// </summary>
	[Serializable]
	public partial class ProductCollection : ActiveList<Product,ProductCollection> 
	{	   
		public ProductCollection() {}

	}

	/// <summary>
	/// This is an ActiveRecord class which wraps the CSK_Store_Product table.
	/// </summary>
	[Serializable]
	public partial class Product : ActiveRecord<Product>, IActiveRecord
	{

        public delegate void ProductHandler(Product product);
        public static event ProductHandler AfterNew;
        public static event ProductHandler BeforeSave;
        public static event ProductHandler AfterSave;
        public static event ProductHandler BeforeDelete;
        public static event ProductHandler AfterDelete;

        public static void AfterNewProduct(Product product)
        {
            if (AfterNew != null)
                AfterNew(product);
        }

        public static void BeforeSaveProduct(Product product)
        {
            if (BeforeSave != null)
                BeforeSave(product);
        }

        public static void AfterSaveProduct(Product product)
        {
            if (AfterSave != null)
                AfterSave(product);
        }

        public static void BeforeDeleteProduct(Product product)
        {
            if (BeforeDelete != null)
                BeforeDelete(product);
        }

        public static void AfterDeleteProduct(Product product)
        {
            if (AfterDelete != null)
                AfterDelete(product);
        }


		#region .ctors and Default Settings
		
		public Product()
		{
		  SetSQLProps();
		  InitSetDefaults();
		  MarkNew();
		}

		
		private void InitSetDefaults() { SetDefaults(); }

		
		public Product(bool useDatabaseDefaults)
		{
			SetSQLProps();
			if(useDatabaseDefaults)
				ForceDefaults();
			MarkNew();
		}

        
		public Product(object keyID)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByKey(keyID);
		}

		 
		public Product(string columnName, object columnValue)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByParam(columnName,columnValue);
		}

		
		protected static void SetSQLProps() { GetTableSchema(); }

		
		#endregion
		
		#region Schema and Query Accessor	
		public static Query CreateQuery() { return new Query(Schema); }

		public static TableSchema.Table Schema
		{
			get
			{
				if (BaseSchema == null)
					SetSQLProps();
				return BaseSchema;
			}

		}

		
		public static void GetTableSchema() 
		{
			if(!IsSchemaInitialized)
			{
				//Schema declaration
				TableSchema.Table schema = new TableSchema.Table("CSK_Store_Product", TableType.Table, DataService.GetInstance("dashCommerce"));
				schema.Columns = new TableSchema.TableColumnCollection();
				schema.SchemaName = @"dbo";
				//columns
				
				TableSchema.TableColumn colvarProductID = new TableSchema.TableColumn(schema);
				colvarProductID.ColumnName = "productID";
				colvarProductID.DataType = DbType.Int32;
				colvarProductID.MaxLength = 0;
				colvarProductID.AutoIncrement = true;
				colvarProductID.IsNullable = false;
				colvarProductID.IsPrimaryKey = true;
				colvarProductID.IsForeignKey = false;
				colvarProductID.IsReadOnly = false;
				colvarProductID.DefaultSetting = @"";
				colvarProductID.ForeignKeyTableName = "";
				schema.Columns.Add(colvarProductID);
				
				TableSchema.TableColumn colvarSku = new TableSchema.TableColumn(schema);
				colvarSku.ColumnName = "sku";
				colvarSku.DataType = DbType.String;
				colvarSku.MaxLength = 50;
				colvarSku.AutoIncrement = false;
				colvarSku.IsNullable = true;
				colvarSku.IsPrimaryKey = false;
				colvarSku.IsForeignKey = false;
				colvarSku.IsReadOnly = false;
				colvarSku.DefaultSetting = @"";
				colvarSku.ForeignKeyTableName = "";
				schema.Columns.Add(colvarSku);
				
				TableSchema.TableColumn colvarProductGUID = new TableSchema.TableColumn(schema);
				colvarProductGUID.ColumnName = "productGUID";
				colvarProductGUID.DataType = DbType.Guid;
				colvarProductGUID.MaxLength = 0;
				colvarProductGUID.AutoIncrement = false;
				colvarProductGUID.IsNullable = false;
				colvarProductGUID.IsPrimaryKey = false;
				colvarProductGUID.IsForeignKey = false;
				colvarProductGUID.IsReadOnly = false;
				
						colvarProductGUID.DefaultSetting = @"(newid())";
				colvarProductGUID.ForeignKeyTableName = "";
				schema.Columns.Add(colvarProductGUID);
				
				TableSchema.TableColumn colvarProductName = new TableSchema.TableColumn(schema);
				colvarProductName.ColumnName = "productName";
				colvarProductName.DataType = DbType.String;
				colvarProductName.MaxLength = 150;
				colvarProductName.AutoIncrement = false;
				colvarProductName.IsNullable = false;
				colvarProductName.IsPrimaryKey = false;
				colvarProductName.IsForeignKey = false;
				colvarProductName.IsReadOnly = false;
				colvarProductName.DefaultSetting = @"";
				colvarProductName.ForeignKeyTableName = "";
				schema.Columns.Add(colvarProductName);
				
				TableSchema.TableColumn colvarShortDescription = new TableSchema.TableColumn(schema);
				colvarShortDescription.ColumnName = "shortDescription";
				colvarShortDescription.DataType = DbType.String;
				colvarShortDescription.MaxLength = 1000;
				colvarShortDescription.AutoIncrement = false;
				colvarShortDescription.IsNullable = true;
				colvarShortDescription.IsPrimaryKey = false;
				colvarShortDescription.IsForeignKey = false;
				colvarShortDescription.IsReadOnly = false;
				colvarShortDescription.DefaultSetting = @"";
				colvarShortDescription.ForeignKeyTableName = "";
				schema.Columns.Add(colvarShortDescription);
				
				TableSchema.TableColumn colvarManufacturerID = new TableSchema.TableColumn(schema);
				colvarManufacturerID.ColumnName = "manufacturerID";
				colvarManufacturerID.DataType = DbType.Int32;
				colvarManufacturerID.MaxLength = 0;
				colvarManufacturerID.AutoIncrement = false;
				colvarManufacturerID.IsNullable = false;
				colvarManufacturerID.IsPrimaryKey = false;
				colvarManufacturerID.IsForeignKey = true;
				colvarManufacturerID.IsReadOnly = false;
				
						colvarManufacturerID.DefaultSetting = @"((1))";
				
					colvarManufacturerID.ForeignKeyTableName = "CSK_Store_Manufacturer";
				schema.Columns.Add(colvarManufacturerID);
				
				TableSchema.TableColumn colvarAttributeXML = new TableSchema.TableColumn(schema);
				colvarAttributeXML.ColumnName = "attributeXML";
				colvarAttributeXML.DataType = DbType.String;
				colvarAttributeXML.MaxLength = 1073741823;
				colvarAttributeXML.AutoIncrement = false;
				colvarAttributeXML.IsNullable = true;
				colvarAttributeXML.IsPrimaryKey = false;
				colvarAttributeXML.IsForeignKey = false;
				colvarAttributeXML.IsReadOnly = false;
				colvarAttributeXML.DefaultSetting = @"";
				colvarAttributeXML.ForeignKeyTableName = "";
				schema.Columns.Add(colvarAttributeXML);
				
				TableSchema.TableColumn colvarStatusID = new TableSchema.TableColumn(schema);
				colvarStatusID.ColumnName = "statusID";
				colvarStatusID.DataType = DbType.Int32;
				colvarStatusID.MaxLength = 0;
				colvarStatusID.AutoIncrement = false;
				colvarStatusID.IsNullable = false;
				colvarStatusID.IsPrimaryKey = false;
				colvarStatusID.IsForeignKey = true;
				colvarStatusID.IsReadOnly = false;
				
						colvarStatusID.DefaultSetting = @"((1))";
				
					colvarStatusID.ForeignKeyTableName = "CSK_Store_ProductStatus";
				schema.Columns.Add(colvarStatusID);
				
				TableSchema.TableColumn colvarProductTypeID = new TableSchema.TableColumn(schema);
				colvarProductTypeID.ColumnName = "productTypeID";
				colvarProductTypeID.DataType = DbType.Int32;
				colvarProductTypeID.MaxLength = 0;
				colvarProductTypeID.AutoIncrement = false;
				colvarProductTypeID.IsNullable = false;
				colvarProductTypeID.IsPrimaryKey = false;
				colvarProductTypeID.IsForeignKey = true;
				colvarProductTypeID.IsReadOnly = false;
				
						colvarProductTypeID.DefaultSetting = @"((1))";
				
					colvarProductTypeID.ForeignKeyTableName = "CSK_Store_ProductType";
				schema.Columns.Add(colvarProductTypeID);
				
				TableSchema.TableColumn colvarShippingTypeID = new TableSchema.TableColumn(schema);
				colvarShippingTypeID.ColumnName = "shippingTypeID";
				colvarShippingTypeID.DataType = DbType.Int32;
				colvarShippingTypeID.MaxLength = 0;
				colvarShippingTypeID.AutoIncrement = false;
				colvarShippingTypeID.IsNullable = false;
				colvarShippingTypeID.IsPrimaryKey = false;
				colvarShippingTypeID.IsForeignKey = true;
				colvarShippingTypeID.IsReadOnly = false;
				
						colvarShippingTypeID.DefaultSetting = @"((1))";
				
					colvarShippingTypeID.ForeignKeyTableName = "CSK_Store_ShippingType";
				schema.Columns.Add(colvarShippingTypeID);
				
				TableSchema.TableColumn colvarShipEstimateID = new TableSchema.TableColumn(schema);
				colvarShipEstimateID.ColumnName = "shipEstimateID";
				colvarShipEstimateID.DataType = DbType.Int32;
				colvarShipEstimateID.MaxLength = 0;
				colvarShipEstimateID.AutoIncrement = false;
				colvarShipEstimateID.IsNullable = false;
				colvarShipEstimateID.IsPrimaryKey = false;
				colvarShipEstimateID.IsForeignKey = true;
				colvarShipEstimateID.IsReadOnly = false;
				
						colvarShipEstimateID.DefaultSetting = @"((1))";
				
					colvarShipEstimateID.ForeignKeyTableName = "CSK_Store_ShippingEstimate";
				schema.Columns.Add(colvarShipEstimateID);
				
				TableSchema.TableColumn colvarTaxTypeID = new TableSchema.TableColumn(schema);
				colvarTaxTypeID.ColumnName = "taxTypeID";
				colvarTaxTypeID.DataType = DbType.Int32;
				colvarTaxTypeID.MaxLength = 0;
				colvarTaxTypeID.AutoIncrement = false;
				colvarTaxTypeID.IsNullable = false;
				colvarTaxTypeID.IsPrimaryKey = false;
				colvarTaxTypeID.IsForeignKey = true;
				colvarTaxTypeID.IsReadOnly = false;
				
						colvarTaxTypeID.DefaultSetting = @"((1))";
				
					colvarTaxTypeID.ForeignKeyTableName = "CSK_Tax_Type";
				schema.Columns.Add(colvarTaxTypeID);
				
				TableSchema.TableColumn colvarStockLocation = new TableSchema.TableColumn(schema);
				colvarStockLocation.ColumnName = "stockLocation";
				colvarStockLocation.DataType = DbType.String;
				colvarStockLocation.MaxLength = 150;
				colvarStockLocation.AutoIncrement = false;
				colvarStockLocation.IsNullable = true;
				colvarStockLocation.IsPrimaryKey = false;
				colvarStockLocation.IsForeignKey = false;
				colvarStockLocation.IsReadOnly = false;
				colvarStockLocation.DefaultSetting = @"";
				colvarStockLocation.ForeignKeyTableName = "";
				schema.Columns.Add(colvarStockLocation);
				
				TableSchema.TableColumn colvarOurPrice = new TableSchema.TableColumn(schema);
				colvarOurPrice.ColumnName = "ourPrice";
				colvarOurPrice.DataType = DbType.Currency;
				colvarOurPrice.MaxLength = 0;
				colvarOurPrice.AutoIncrement = false;
				colvarOurPrice.IsNullable = false;
				colvarOurPrice.IsPrimaryKey = false;
				colvarOurPrice.IsForeignKey = false;
				colvarOurPrice.IsReadOnly = false;
				colvarOurPrice.DefaultSetting = @"";
				colvarOurPrice.ForeignKeyTableName = "";
				schema.Columns.Add(colvarOurPrice);
				
				TableSchema.TableColumn colvarRetailPrice = new TableSchema.TableColumn(schema);
				colvarRetailPrice.ColumnName = "retailPrice";
				colvarRetailPrice.DataType = DbType.Currency;
				colvarRetailPrice.MaxLength = 0;
				colvarRetailPrice.AutoIncrement = false;
				colvarRetailPrice.IsNullable = false;
				colvarRetailPrice.IsPrimaryKey = false;
				colvarRetailPrice.IsForeignKey = false;
				colvarRetailPrice.IsReadOnly = false;
				colvarRetailPrice.DefaultSetting = @"";
				colvarRetailPrice.ForeignKeyTableName = "";
				schema.Columns.Add(colvarRetailPrice);
				
				TableSchema.TableColumn colvarWeight = new TableSchema.TableColumn(schema);
				colvarWeight.ColumnName = "weight";
				colvarWeight.DataType = DbType.Decimal;
				colvarWeight.MaxLength = 0;
				colvarWeight.AutoIncrement = false;
				colvarWeight.IsNullable = false;
				colvarWeight.IsPrimaryKey = false;
				colvarWeight.IsForeignKey = false;
				colvarWeight.IsReadOnly = false;
				
						colvarWeight.DefaultSetting = @"((0))";
				colvarWeight.ForeignKeyTableName = "";
				schema.Columns.Add(colvarWeight);
				
				TableSchema.TableColumn colvarCurrencyCode = new TableSchema.TableColumn(schema);
				colvarCurrencyCode.ColumnName = "currencyCode";
				colvarCurrencyCode.DataType = DbType.AnsiStringFixedLength;
				colvarCurrencyCode.MaxLength = 3;
				colvarCurrencyCode.AutoIncrement = false;
				colvarCurrencyCode.IsNullable = false;
				colvarCurrencyCode.IsPrimaryKey = false;
				colvarCurrencyCode.IsForeignKey = false;
				colvarCurrencyCode.IsReadOnly = false;
				
						colvarCurrencyCode.DefaultSetting = @"('USD')";
				colvarCurrencyCode.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCurrencyCode);
				
				TableSchema.TableColumn colvarUnitOfMeasure = new TableSchema.TableColumn(schema);
				colvarUnitOfMeasure.ColumnName = "unitOfMeasure";
				colvarUnitOfMeasure.DataType = DbType.String;
				colvarUnitOfMeasure.MaxLength = 50;
				colvarUnitOfMeasure.AutoIncrement = false;
				colvarUnitOfMeasure.IsNullable = true;
				colvarUnitOfMeasure.IsPrimaryKey = false;
				colvarUnitOfMeasure.IsForeignKey = false;
				colvarUnitOfMeasure.IsReadOnly = false;
				colvarUnitOfMeasure.DefaultSetting = @"";
				colvarUnitOfMeasure.ForeignKeyTableName = "";
				schema.Columns.Add(colvarUnitOfMeasure);
				
				TableSchema.TableColumn colvarAdminComments = new TableSchema.TableColumn(schema);
				colvarAdminComments.ColumnName = "adminComments";
				colvarAdminComments.DataType = DbType.String;
				colvarAdminComments.MaxLength = 1000;
				colvarAdminComments.AutoIncrement = false;
				colvarAdminComments.IsNullable = true;
				colvarAdminComments.IsPrimaryKey = false;
				colvarAdminComments.IsForeignKey = false;
				colvarAdminComments.IsReadOnly = false;
				colvarAdminComments.DefaultSetting = @"";
				colvarAdminComments.ForeignKeyTableName = "";
				schema.Columns.Add(colvarAdminComments);
				
				TableSchema.TableColumn colvarLength = new TableSchema.TableColumn(schema);
				colvarLength.ColumnName = "length";
				colvarLength.DataType = DbType.Decimal;
				colvarLength.MaxLength = 0;
				colvarLength.AutoIncrement = false;
				colvarLength.IsNullable = false;
				colvarLength.IsPrimaryKey = false;
				colvarLength.IsForeignKey = false;
				colvarLength.IsReadOnly = false;
				
						colvarLength.DefaultSetting = @"((0))";
				colvarLength.ForeignKeyTableName = "";
				schema.Columns.Add(colvarLength);
				
				TableSchema.TableColumn colvarHeight = new TableSchema.TableColumn(schema);
				colvarHeight.ColumnName = "height";
				colvarHeight.DataType = DbType.Decimal;
				colvarHeight.MaxLength = 0;
				colvarHeight.AutoIncrement = false;
				colvarHeight.IsNullable = false;
				colvarHeight.IsPrimaryKey = false;
				colvarHeight.IsForeignKey = false;
				colvarHeight.IsReadOnly = false;
				
						colvarHeight.DefaultSetting = @"((0))";
				colvarHeight.ForeignKeyTableName = "";
				schema.Columns.Add(colvarHeight);
				
				TableSchema.TableColumn colvarWidth = new TableSchema.TableColumn(schema);
				colvarWidth.ColumnName = "width";
				colvarWidth.DataType = DbType.Decimal;
				colvarWidth.MaxLength = 0;
				colvarWidth.AutoIncrement = false;
				colvarWidth.IsNullable = false;
				colvarWidth.IsPrimaryKey = false;
				colvarWidth.IsForeignKey = false;
				colvarWidth.IsReadOnly = false;
				
						colvarWidth.DefaultSetting = @"((0))";
				colvarWidth.ForeignKeyTableName = "";
				schema.Columns.Add(colvarWidth);
				
				TableSchema.TableColumn colvarDimensionUnit = new TableSchema.TableColumn(schema);
				colvarDimensionUnit.ColumnName = "dimensionUnit";
				colvarDimensionUnit.DataType = DbType.String;
				colvarDimensionUnit.MaxLength = 20;
				colvarDimensionUnit.AutoIncrement = false;
				colvarDimensionUnit.IsNullable = false;
				colvarDimensionUnit.IsPrimaryKey = false;
				colvarDimensionUnit.IsForeignKey = false;
				colvarDimensionUnit.IsReadOnly = false;
				
						colvarDimensionUnit.DefaultSetting = @"('inches')";
				colvarDimensionUnit.ForeignKeyTableName = "";
				schema.Columns.Add(colvarDimensionUnit);
				
				TableSchema.TableColumn colvarIsDeleted = new TableSchema.TableColumn(schema);
				colvarIsDeleted.ColumnName = "isDeleted";
				colvarIsDeleted.DataType = DbType.Boolean;
				colvarIsDeleted.MaxLength = 0;
				colvarIsDeleted.AutoIncrement = false;
				colvarIsDeleted.IsNullable = false;
				colvarIsDeleted.IsPrimaryKey = false;
				colvarIsDeleted.IsForeignKey = false;
				colvarIsDeleted.IsReadOnly = false;
				
						colvarIsDeleted.DefaultSetting = @"((0))";
				colvarIsDeleted.ForeignKeyTableName = "";
				schema.Columns.Add(colvarIsDeleted);
				
				TableSchema.TableColumn colvarListOrder = new TableSchema.TableColumn(schema);
				colvarListOrder.ColumnName = "listOrder";
				colvarListOrder.DataType = DbType.Int32;
				colvarListOrder.MaxLength = 0;
				colvarListOrder.AutoIncrement = false;
				colvarListOrder.IsNullable = false;
				colvarListOrder.IsPrimaryKey = false;
				colvarListOrder.IsForeignKey = false;
				colvarListOrder.IsReadOnly = false;
				
						colvarListOrder.DefaultSetting = @"((1))";
				colvarListOrder.ForeignKeyTableName = "";
				schema.Columns.Add(colvarListOrder);
				
				TableSchema.TableColumn colvarRatingSum = new TableSchema.TableColumn(schema);
				colvarRatingSum.ColumnName = "ratingSum";
				colvarRatingSum.DataType = DbType.Int32;
				colvarRatingSum.MaxLength = 0;
				colvarRatingSum.AutoIncrement = false;
				colvarRatingSum.IsNullable = false;
				colvarRatingSum.IsPrimaryKey = false;
				colvarRatingSum.IsForeignKey = false;
				colvarRatingSum.IsReadOnly = false;
				
						colvarRatingSum.DefaultSetting = @"((4))";
				colvarRatingSum.ForeignKeyTableName = "";
				schema.Columns.Add(colvarRatingSum);
				
				TableSchema.TableColumn colvarTotalRatingVotes = new TableSchema.TableColumn(schema);
				colvarTotalRatingVotes.ColumnName = "totalRatingVotes";
				colvarTotalRatingVotes.DataType = DbType.Int32;
				colvarTotalRatingVotes.MaxLength = 0;
				colvarTotalRatingVotes.AutoIncrement = false;
				colvarTotalRatingVotes.IsNullable = false;
				colvarTotalRatingVotes.IsPrimaryKey = false;
				colvarTotalRatingVotes.IsForeignKey = false;
				colvarTotalRatingVotes.IsReadOnly = false;
				
						colvarTotalRatingVotes.DefaultSetting = @"((1))";
				colvarTotalRatingVotes.ForeignKeyTableName = "";
				schema.Columns.Add(colvarTotalRatingVotes);
				
				TableSchema.TableColumn colvarDefaultImage = new TableSchema.TableColumn(schema);
				colvarDefaultImage.ColumnName = "defaultImage";
				colvarDefaultImage.DataType = DbType.String;
				colvarDefaultImage.MaxLength = 500;
				colvarDefaultImage.AutoIncrement = false;
				colvarDefaultImage.IsNullable = true;
				colvarDefaultImage.IsPrimaryKey = false;
				colvarDefaultImage.IsForeignKey = false;
				colvarDefaultImage.IsReadOnly = false;
				colvarDefaultImage.DefaultSetting = @"";
				colvarDefaultImage.ForeignKeyTableName = "";
				schema.Columns.Add(colvarDefaultImage);
				
				TableSchema.TableColumn colvarCreatedOn = new TableSchema.TableColumn(schema);
				colvarCreatedOn.ColumnName = "createdOn";
				colvarCreatedOn.DataType = DbType.DateTime;
				colvarCreatedOn.MaxLength = 0;
				colvarCreatedOn.AutoIncrement = false;
				colvarCreatedOn.IsNullable = true;
				colvarCreatedOn.IsPrimaryKey = false;
				colvarCreatedOn.IsForeignKey = false;
				colvarCreatedOn.IsReadOnly = false;
				
						colvarCreatedOn.DefaultSetting = @"(getdate())";
				colvarCreatedOn.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCreatedOn);
				
				TableSchema.TableColumn colvarCreatedBy = new TableSchema.TableColumn(schema);
				colvarCreatedBy.ColumnName = "createdBy";
				colvarCreatedBy.DataType = DbType.String;
				colvarCreatedBy.MaxLength = 50;
				colvarCreatedBy.AutoIncrement = false;
				colvarCreatedBy.IsNullable = true;
				colvarCreatedBy.IsPrimaryKey = false;
				colvarCreatedBy.IsForeignKey = false;
				colvarCreatedBy.IsReadOnly = false;
				colvarCreatedBy.DefaultSetting = @"";
				colvarCreatedBy.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCreatedBy);
				
				TableSchema.TableColumn colvarModifiedOn = new TableSchema.TableColumn(schema);
				colvarModifiedOn.ColumnName = "modifiedOn";
				colvarModifiedOn.DataType = DbType.DateTime;
				colvarModifiedOn.MaxLength = 0;
				colvarModifiedOn.AutoIncrement = false;
				colvarModifiedOn.IsNullable = true;
				colvarModifiedOn.IsPrimaryKey = false;
				colvarModifiedOn.IsForeignKey = false;
				colvarModifiedOn.IsReadOnly = false;
				
						colvarModifiedOn.DefaultSetting = @"(getdate())";
				colvarModifiedOn.ForeignKeyTableName = "";
				schema.Columns.Add(colvarModifiedOn);
				
				TableSchema.TableColumn colvarModifiedBy = new TableSchema.TableColumn(schema);
				colvarModifiedBy.ColumnName = "modifiedBy";
				colvarModifiedBy.DataType = DbType.String;
				colvarModifiedBy.MaxLength = 50;
				colvarModifiedBy.AutoIncrement = false;
				colvarModifiedBy.IsNullable = true;
				colvarModifiedBy.IsPrimaryKey = false;
				colvarModifiedBy.IsForeignKey = false;
				colvarModifiedBy.IsReadOnly = false;
				colvarModifiedBy.DefaultSetting = @"";
				colvarModifiedBy.ForeignKeyTableName = "";
				schema.Columns.Add(colvarModifiedBy);
				
				BaseSchema = schema;
				//add this schema to the provider
				//so we can query it later
				DataService.Providers["dashCommerce"].AddSchema("CSK_Store_Product",schema);
			}

		}

		#endregion
		
		#region Props
		
		  
		[XmlAttribute("ProductID")]
		public int ProductID 
		{
			get { return GetColumnValue<int>(Columns.ProductID); }

			set { SetColumnValue(Columns.ProductID, value); }

		}

		  
		[XmlAttribute("Sku")]
		public string Sku 
		{
			get { return GetColumnValue<string>(Columns.Sku); }

			set { SetColumnValue(Columns.Sku, value); }

		}

		  
		[XmlAttribute("ProductGUID")]
		public Guid ProductGUID 
		{
			get { return GetColumnValue<Guid>(Columns.ProductGUID); }

			set { SetColumnValue(Columns.ProductGUID, value); }

		}

		  
		[XmlAttribute("ProductName")]
		public string ProductName 
		{
			get { return GetColumnValue<string>(Columns.ProductName); }

			set { SetColumnValue(Columns.ProductName, value); }

		}

		  
		[XmlAttribute("ShortDescription")]
		public string ShortDescription 
		{
			get { return GetColumnValue<string>(Columns.ShortDescription); }

			set { SetColumnValue(Columns.ShortDescription, value); }

		}

		  
		[XmlAttribute("ManufacturerID")]
		public int ManufacturerID 
		{
			get { return GetColumnValue<int>(Columns.ManufacturerID); }

			set { SetColumnValue(Columns.ManufacturerID, value); }

		}

		  
		[XmlAttribute("AttributeXML")]
		public string AttributeXML 
		{
			get { return GetColumnValue<string>(Columns.AttributeXML); }

			set { SetColumnValue(Columns.AttributeXML, value); }

		}

		  
		[XmlAttribute("StatusID")]
		public int StatusID 
		{
			get { return GetColumnValue<int>(Columns.StatusID); }

			set { SetColumnValue(Columns.StatusID, value); }

		}

		  
		[XmlAttribute("ProductTypeID")]
		public int ProductTypeID 
		{
			get { return GetColumnValue<int>(Columns.ProductTypeID); }

			set { SetColumnValue(Columns.ProductTypeID, value); }

		}

		  
		[XmlAttribute("ShippingTypeID")]
		public int ShippingTypeID 
		{
			get { return GetColumnValue<int>(Columns.ShippingTypeID); }

			set { SetColumnValue(Columns.ShippingTypeID, value); }

		}

		  
		[XmlAttribute("ShipEstimateID")]
		public int ShipEstimateID 
		{
			get { return GetColumnValue<int>(Columns.ShipEstimateID); }

			set { SetColumnValue(Columns.ShipEstimateID, value); }

		}

		  
		[XmlAttribute("TaxTypeID")]
		public int TaxTypeID 
		{
			get { return GetColumnValue<int>(Columns.TaxTypeID); }

			set { SetColumnValue(Columns.TaxTypeID, value); }

		}

		  
		[XmlAttribute("StockLocation")]
		public string StockLocation 
		{
			get { return GetColumnValue<string>(Columns.StockLocation); }

			set { SetColumnValue(Columns.StockLocation, value); }

		}

		  
		[XmlAttribute("OurPrice")]
		public decimal OurPrice 
		{
			get { return GetColumnValue<decimal>(Columns.OurPrice); }

			set { SetColumnValue(Columns.OurPrice, value); }

		}

		  
		[XmlAttribute("RetailPrice")]
		public decimal RetailPrice 
		{
			get { return GetColumnValue<decimal>(Columns.RetailPrice); }

			set { SetColumnValue(Columns.RetailPrice, value); }

		}

		  
		[XmlAttribute("Weight")]
		public decimal Weight 
		{
			get { return GetColumnValue<decimal>(Columns.Weight); }

			set { SetColumnValue(Columns.Weight, value); }

		}

		  
		[XmlAttribute("CurrencyCode")]
		public string CurrencyCode 
		{
			get { return GetColumnValue<string>(Columns.CurrencyCode); }

			set { SetColumnValue(Columns.CurrencyCode, value); }

		}

		  
		[XmlAttribute("UnitOfMeasure")]
		public string UnitOfMeasure 
		{
			get { return GetColumnValue<string>(Columns.UnitOfMeasure); }

			set { SetColumnValue(Columns.UnitOfMeasure, value); }

		}

		  
		[XmlAttribute("AdminComments")]
		public string AdminComments 
		{
			get { return GetColumnValue<string>(Columns.AdminComments); }

			set { SetColumnValue(Columns.AdminComments, value); }

		}

		  
		[XmlAttribute("Length")]
		public decimal Length 
		{
			get { return GetColumnValue<decimal>(Columns.Length); }

			set { SetColumnValue(Columns.Length, value); }

		}

		  
		[XmlAttribute("Height")]
		public decimal Height 
		{
			get { return GetColumnValue<decimal>(Columns.Height); }

			set { SetColumnValue(Columns.Height, value); }

		}

		  
		[XmlAttribute("Width")]
		public decimal Width 
		{
			get { return GetColumnValue<decimal>(Columns.Width); }

			set { SetColumnValue(Columns.Width, value); }

		}

		  
		[XmlAttribute("DimensionUnit")]
		public string DimensionUnit 
		{
			get { return GetColumnValue<string>(Columns.DimensionUnit); }

			set { SetColumnValue(Columns.DimensionUnit, value); }

		}

		  
		[XmlAttribute("IsDeleted")]
		public bool IsDeleted 
		{
			get { return GetColumnValue<bool>(Columns.IsDeleted); }

			set { SetColumnValue(Columns.IsDeleted, value); }

		}

		  
		[XmlAttribute("ListOrder")]
		public int ListOrder 
		{
			get { return GetColumnValue<int>(Columns.ListOrder); }

			set { SetColumnValue(Columns.ListOrder, value); }

		}

		  
		[XmlAttribute("RatingSum")]
		public int RatingSum 
		{
			get { return GetColumnValue<int>(Columns.RatingSum); }

			set { SetColumnValue(Columns.RatingSum, value); }

		}

		  
		[XmlAttribute("TotalRatingVotes")]
		public int TotalRatingVotes 
		{
			get { return GetColumnValue<int>(Columns.TotalRatingVotes); }

			set { SetColumnValue(Columns.TotalRatingVotes, value); }

		}

		  
		[XmlAttribute("DefaultImage")]
		public string DefaultImage 
		{
			get { return GetColumnValue<string>(Columns.DefaultImage); }

			set { SetColumnValue(Columns.DefaultImage, value); }

		}

		
		
		//private DateTime? propCreatedOn;
		[XmlAttribute("CreatedOn")]
		public DateTime CreatedOn 
		{
			get
			{
			DateTime? propCreatedOn = GetColumnValue<DateTime?>(Columns.CreatedOn);
				if (!propCreatedOn.HasValue)
					return new DateTime(1900,01, 01);
				return propCreatedOn.Value;
			}

		   set { SetColumnValue(Columns.CreatedOn, value); }

		}

		
		[XmlIgnore]
		public bool CreatedOnHasValue
		{
			get { return GetColumnValue<DateTime?>("createdOn") != null; }

			set
			{
				DateTime? propCreatedOn = GetColumnValue<DateTime?>(Columns.CreatedOn);
				if (!value)
					SetColumnValue(Columns.CreatedOn, null);
				else if (value && !propCreatedOn.HasValue)
					SetColumnValue(Columns.CreatedOn, new DateTime(1900,01, 01));
		   }

		}

		
		  
		[XmlAttribute("CreatedBy")]
		public string CreatedBy 
		{
			get { return GetColumnValue<string>(Columns.CreatedBy); }

			set { SetColumnValue(Columns.CreatedBy, value); }

		}

		
		
		//private DateTime? propModifiedOn;
		[XmlAttribute("ModifiedOn")]
		public DateTime ModifiedOn 
		{
			get
			{
			DateTime? propModifiedOn = GetColumnValue<DateTime?>(Columns.ModifiedOn);
				if (!propModifiedOn.HasValue)
					return new DateTime(1900,01, 01);
				return propModifiedOn.Value;
			}

		   set { SetColumnValue(Columns.ModifiedOn, value); }

		}

		
		[XmlIgnore]
		public bool ModifiedOnHasValue
		{
			get { return GetColumnValue<DateTime?>("modifiedOn") != null; }

			set
			{
				DateTime? propModifiedOn = GetColumnValue<DateTime?>(Columns.ModifiedOn);
				if (!value)
					SetColumnValue(Columns.ModifiedOn, null);
				else if (value && !propModifiedOn.HasValue)
					SetColumnValue(Columns.ModifiedOn, new DateTime(1900,01, 01));
		   }

		}

		
		  
		[XmlAttribute("ModifiedBy")]
		public string ModifiedBy 
		{
			get { return GetColumnValue<string>(Columns.ModifiedBy); }

			set { SetColumnValue(Columns.ModifiedBy, value); }

		}

		
		#endregion
		
		
		#region PrimaryKey Methods
		
		public Commerce.Common.AttributeCollection AttributeRecords()
		{
			return new Commerce.Common.AttributeCollection().Where(Attribute.Columns.ProductID, ProductID).Load();
		}

		public Commerce.Common.ImageCollection ImageRecords()
		{
			return new Commerce.Common.ImageCollection().Where(Image.Columns.ProductID, ProductID).Load();
		}

		public Commerce.Common.PromoProductBundleMapCollection PromoProductBundleMapRecords()
		{
			return new Commerce.Common.PromoProductBundleMapCollection().Where(PromoProductBundleMap.Columns.ProductID, ProductID).Load();
		}

		public Commerce.Common.ProductCategoryMapCollection ProductCategoryMapRecords()
		{
			return new Commerce.Common.ProductCategoryMapCollection().Where(ProductCategoryMap.Columns.ProductID, ProductID).Load();
		}

		public Commerce.Common.PromoProductPromoMapCollection PromoProductPromoMapRecords()
		{
			return new Commerce.Common.PromoProductPromoMapCollection().Where(PromoProductPromoMap.Columns.ProductID, ProductID).Load();
		}

		public Commerce.Common.PromoProductCrossSellMapCollection PromoProductCrossSellMapRecords()
		{
			return new Commerce.Common.PromoProductCrossSellMapCollection().Where(PromoProductCrossSellMap.Columns.ProductID, ProductID).Load();
		}

		public Commerce.Common.PromoProductCrossSellMapCollection PromoProductCrossSellMapRecordsFromProduct()
		{
			return new Commerce.Common.PromoProductCrossSellMapCollection().Where(PromoProductCrossSellMap.Columns.CrossProductID, ProductID).Load();
		}

		public Commerce.Common.ProductDescriptorCollection ProductDescriptorRecords()
		{
			return new Commerce.Common.ProductDescriptorCollection().Where(ProductDescriptor.Columns.ProductID, ProductID).Load();
		}

		#endregion
		
			
		
		#region ForeignKey Properties
		
		/// <summary>
		/// Returns a Manufacturer ActiveRecord object related to this Product
		/// 
		/// </summary>
		public Commerce.Common.Manufacturer Manufacturer
		{
			get { return Commerce.Common.Manufacturer.FetchByID(this.ManufacturerID); }

			set { SetColumnValue("manufacturerID", value.ManufacturerID); }

		}

		
		
		/// <summary>
		/// Returns a ProductStatuss ActiveRecord object related to this Product
		/// 
		/// </summary>
		public Commerce.Common.ProductStatuss ProductStatuss
		{
			get { return Commerce.Common.ProductStatuss.FetchByID(this.StatusID); }

			set { SetColumnValue("statusID", value.StatusID); }

		}

		
		
		/// <summary>
		/// Returns a ProductTypes ActiveRecord object related to this Product
		/// 
		/// </summary>
		public Commerce.Common.ProductTypes ProductTypes
		{
			get { return Commerce.Common.ProductTypes.FetchByID(this.ProductTypeID); }

			set { SetColumnValue("productTypeID", value.ProductTypeID); }

		}

		
		
		/// <summary>
		/// Returns a ShippingEstimates ActiveRecord object related to this Product
		/// 
		/// </summary>
		public Commerce.Common.ShippingEstimates ShippingEstimates
		{
			get { return Commerce.Common.ShippingEstimates.FetchByID(this.ShipEstimateID); }

			set { SetColumnValue("shipEstimateID", value.ShipEstimateID); }

		}

		
		
		/// <summary>
		/// Returns a ShippingTypes ActiveRecord object related to this Product
		/// 
		/// </summary>
		public Commerce.Common.ShippingTypes ShippingTypes
		{
			get { return Commerce.Common.ShippingTypes.FetchByID(this.ShippingTypeID); }

			set { SetColumnValue("shippingTypeID", value.ShippingTypeID); }

		}

		
		
		/// <summary>
		/// Returns a TaxType ActiveRecord object related to this Product
		/// 
		/// </summary>
		public Commerce.Common.TaxType TaxType
		{
			get { return Commerce.Common.TaxType.FetchByID(this.TaxTypeID); }

			set { SetColumnValue("taxTypeID", value.TaxTypeID); }

		}

		
		
		#endregion
		
		
		
		#region Many To Many Helpers
		
		 
		public Commerce.Common.CategoryCollection GetCategoryCollection() { return Product.GetCategoryCollection(this.ProductID); }

		public static Commerce.Common.CategoryCollection GetCategoryCollection(int varProductID)
		{
		    SubSonic.QueryCommand cmd = new SubSonic.QueryCommand("SELECT * FROM [dbo].[CSK_Store_Category] INNER JOIN [CSK_Store_Product_Category_Map] ON [CSK_Store_Category].[categoryID] = [CSK_Store_Product_Category_Map].[categoryID] WHERE [CSK_Store_Product_Category_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmd.AddParameter("@productID", varProductID, DbType.Int32);
			IDataReader rdr = SubSonic.DataService.GetReader(cmd);
			CategoryCollection coll = new CategoryCollection();
			coll.LoadAndCloseReader(rdr);
			return coll;
		}

		
		public static void SaveCategoryMap(int varProductID, CategoryCollection items)
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Store_Product_Category_Map] WHERE [CSK_Store_Product_Category_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (Category item in items)
			{
				ProductCategoryMap varProductCategoryMap = new ProductCategoryMap();
				varProductCategoryMap.SetColumnValue("productID", varProductID);
				varProductCategoryMap.SetColumnValue("categoryID", item.GetPrimaryKeyValue());
				varProductCategoryMap.Save();
			}

		}

		public static void SaveCategoryMap(int varProductID, System.Web.UI.WebControls.ListItemCollection itemList) 
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			 QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Store_Product_Category_Map] WHERE [CSK_Store_Product_Category_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (System.Web.UI.WebControls.ListItem l in itemList) 
			{
				if (l.Selected) 
				{
					ProductCategoryMap varProductCategoryMap = new ProductCategoryMap();
					varProductCategoryMap.SetColumnValue("productID", varProductID);
					varProductCategoryMap.SetColumnValue("categoryID", l.Value);
					varProductCategoryMap.Save();
				}

			}

		}

		public static void SaveCategoryMap(int varProductID , int[] itemList) 
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			 QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Store_Product_Category_Map] WHERE [CSK_Store_Product_Category_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (int item in itemList) 
			{
				ProductCategoryMap varProductCategoryMap = new ProductCategoryMap();
				varProductCategoryMap.SetColumnValue("productID", varProductID);
				varProductCategoryMap.SetColumnValue("categoryID", item);
				varProductCategoryMap.Save();
			}

		}

		
		public static void DeleteCategoryMap(int varProductID) 
		{
			QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Store_Product_Category_Map] WHERE [CSK_Store_Product_Category_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			DataService.ExecuteQuery(cmdDel);
		}

		
		 
		public Commerce.Common.PromoCollection GetPromoCollection() { return Product.GetPromoCollection(this.ProductID); }

		public static Commerce.Common.PromoCollection GetPromoCollection(int varProductID)
		{
		    SubSonic.QueryCommand cmd = new SubSonic.QueryCommand("SELECT * FROM [dbo].[CSK_Promo] INNER JOIN [CSK_Promo_Product_Promo_Map] ON [CSK_Promo].[promoID] = [CSK_Promo_Product_Promo_Map].[promoID] WHERE [CSK_Promo_Product_Promo_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmd.AddParameter("@productID", varProductID, DbType.Int32);
			IDataReader rdr = SubSonic.DataService.GetReader(cmd);
			PromoCollection coll = new PromoCollection();
			coll.LoadAndCloseReader(rdr);
			return coll;
		}

		
		public static void SavePromoMap(int varProductID, PromoCollection items)
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Promo_Product_Promo_Map] WHERE [CSK_Promo_Product_Promo_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (Promo item in items)
			{
				PromoProductPromoMap varPromoProductPromoMap = new PromoProductPromoMap();
				varPromoProductPromoMap.SetColumnValue("productID", varProductID);
				varPromoProductPromoMap.SetColumnValue("promoID", item.GetPrimaryKeyValue());
				varPromoProductPromoMap.Save();
			}

		}

		public static void SavePromoMap(int varProductID, System.Web.UI.WebControls.ListItemCollection itemList) 
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			 QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Promo_Product_Promo_Map] WHERE [CSK_Promo_Product_Promo_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (System.Web.UI.WebControls.ListItem l in itemList) 
			{
				if (l.Selected) 
				{
					PromoProductPromoMap varPromoProductPromoMap = new PromoProductPromoMap();
					varPromoProductPromoMap.SetColumnValue("productID", varProductID);
					varPromoProductPromoMap.SetColumnValue("promoID", l.Value);
					varPromoProductPromoMap.Save();
				}

			}

		}

		public static void SavePromoMap(int varProductID , int[] itemList) 
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			 QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Promo_Product_Promo_Map] WHERE [CSK_Promo_Product_Promo_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (int item in itemList) 
			{
				PromoProductPromoMap varPromoProductPromoMap = new PromoProductPromoMap();
				varPromoProductPromoMap.SetColumnValue("productID", varProductID);
				varPromoProductPromoMap.SetColumnValue("promoID", item);
				varPromoProductPromoMap.Save();
			}

		}

		
		public static void DeletePromoMap(int varProductID) 
		{
			QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Promo_Product_Promo_Map] WHERE [CSK_Promo_Product_Promo_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			DataService.ExecuteQuery(cmdDel);
		}

		
		 
		public Commerce.Common.PromoBundleCollection GetPromoBundleCollection() { return Product.GetPromoBundleCollection(this.ProductID); }

		public static Commerce.Common.PromoBundleCollection GetPromoBundleCollection(int varProductID)
		{
		    SubSonic.QueryCommand cmd = new SubSonic.QueryCommand("SELECT * FROM [dbo].[CSK_Promo_Bundle] INNER JOIN [CSK_Promo_Product_Bundle_Map] ON [CSK_Promo_Bundle].[bundleID] = [CSK_Promo_Product_Bundle_Map].[bundleID] WHERE [CSK_Promo_Product_Bundle_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmd.AddParameter("@productID", varProductID, DbType.Int32);
			IDataReader rdr = SubSonic.DataService.GetReader(cmd);
			PromoBundleCollection coll = new PromoBundleCollection();
			coll.LoadAndCloseReader(rdr);
			return coll;
		}

		
		public static void SavePromoBundleMap(int varProductID, PromoBundleCollection items)
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Promo_Product_Bundle_Map] WHERE [CSK_Promo_Product_Bundle_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (PromoBundle item in items)
			{
				PromoProductBundleMap varPromoProductBundleMap = new PromoProductBundleMap();
				varPromoProductBundleMap.SetColumnValue("productID", varProductID);
				varPromoProductBundleMap.SetColumnValue("bundleID", item.GetPrimaryKeyValue());
				varPromoProductBundleMap.Save();
			}

		}

		public static void SavePromoBundleMap(int varProductID, System.Web.UI.WebControls.ListItemCollection itemList) 
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			 QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Promo_Product_Bundle_Map] WHERE [CSK_Promo_Product_Bundle_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (System.Web.UI.WebControls.ListItem l in itemList) 
			{
				if (l.Selected) 
				{
					PromoProductBundleMap varPromoProductBundleMap = new PromoProductBundleMap();
					varPromoProductBundleMap.SetColumnValue("productID", varProductID);
					varPromoProductBundleMap.SetColumnValue("bundleID", l.Value);
					varPromoProductBundleMap.Save();
				}

			}

		}

		public static void SavePromoBundleMap(int varProductID , int[] itemList) 
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			 QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Promo_Product_Bundle_Map] WHERE [CSK_Promo_Product_Bundle_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (int item in itemList) 
			{
				PromoProductBundleMap varPromoProductBundleMap = new PromoProductBundleMap();
				varPromoProductBundleMap.SetColumnValue("productID", varProductID);
				varPromoProductBundleMap.SetColumnValue("bundleID", item);
				varPromoProductBundleMap.Save();
			}

		}

		
		public static void DeletePromoBundleMap(int varProductID) 
		{
			QueryCommand cmdDel = new QueryCommand("DELETE FROM [CSK_Promo_Product_Bundle_Map] WHERE [CSK_Promo_Product_Bundle_Map].[productID] = @productID", Product.Schema.Provider.Name);
			cmdDel.AddParameter("@productID", varProductID);
			DataService.ExecuteQuery(cmdDel);
		}

		
		#endregion
		
        
        
		#region ObjectDataSource support
		
		
		/// <summary>
		/// Inserts a record, can be used with the Object Data Source
		/// </summary>
		public static void Insert(string varSku,Guid varProductGUID,string varProductName,string varShortDescription,int varManufacturerID,string varAttributeXML,int varStatusID,int varProductTypeID,int varShippingTypeID,int varShipEstimateID,int varTaxTypeID,string varStockLocation,decimal varOurPrice,decimal varRetailPrice,decimal varWeight,string varCurrencyCode,string varUnitOfMeasure,string varAdminComments,decimal varLength,decimal varHeight,decimal varWidth,string varDimensionUnit,bool varIsDeleted,int varListOrder,int varRatingSum,int varTotalRatingVotes,string varDefaultImage,DateTime varCreatedOn,string varCreatedBy,DateTime varModifiedOn,string varModifiedBy)
		{
			Product item = new Product();
			
			item.Sku = varSku;
			
			item.ProductGUID = varProductGUID;
			
			item.ProductName = varProductName;
			
			item.ShortDescription = varShortDescription;
			
			item.ManufacturerID = varManufacturerID;
			
			item.AttributeXML = varAttributeXML;
			
			item.StatusID = varStatusID;
			
			item.ProductTypeID = varProductTypeID;
			
			item.ShippingTypeID = varShippingTypeID;
			
			item.ShipEstimateID = varShipEstimateID;
			
			item.TaxTypeID = varTaxTypeID;
			
			item.StockLocation = varStockLocation;
			
			item.OurPrice = varOurPrice;
			
			item.RetailPrice = varRetailPrice;
			
			item.Weight = varWeight;
			
			item.CurrencyCode = varCurrencyCode;
			
			item.UnitOfMeasure = varUnitOfMeasure;
			
			item.AdminComments = varAdminComments;
			
			item.Length = varLength;
			
			item.Height = varHeight;
			
			item.Width = varWidth;
			
			item.DimensionUnit = varDimensionUnit;
			
			item.IsDeleted = varIsDeleted;
			
			item.ListOrder = varListOrder;
			
			item.RatingSum = varRatingSum;
			
			item.TotalRatingVotes = varTotalRatingVotes;
			
			item.DefaultImage = varDefaultImage;
			
			item.CreatedOn = varCreatedOn;
			
			item.CreatedBy = varCreatedBy;
			
			item.ModifiedOn = varModifiedOn;
			
			item.ModifiedBy = varModifiedBy;
			
		
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}

		
		/// <summary>
		/// Updates a record, can be used with the Object Data Source
		/// </summary>
		public static void Update(int varProductID,string varSku,Guid varProductGUID,string varProductName,string varShortDescription,int varManufacturerID,string varAttributeXML,int varStatusID,int varProductTypeID,int varShippingTypeID,int varShipEstimateID,int varTaxTypeID,string varStockLocation,decimal varOurPrice,decimal varRetailPrice,decimal varWeight,string varCurrencyCode,string varUnitOfMeasure,string varAdminComments,decimal varLength,decimal varHeight,decimal varWidth,string varDimensionUnit,bool varIsDeleted,int varListOrder,int varRatingSum,int varTotalRatingVotes,string varDefaultImage,DateTime varCreatedOn,string varCreatedBy,DateTime varModifiedOn,string varModifiedBy)
		{
			Product item = new Product();
			
				item.ProductID = varProductID;
			
				item.Sku = varSku;
			
				item.ProductGUID = varProductGUID;
			
				item.ProductName = varProductName;
			
				item.ShortDescription = varShortDescription;
			
				item.ManufacturerID = varManufacturerID;
			
				item.AttributeXML = varAttributeXML;
			
				item.StatusID = varStatusID;
			
				item.ProductTypeID = varProductTypeID;
			
				item.ShippingTypeID = varShippingTypeID;
			
				item.ShipEstimateID = varShipEstimateID;
			
				item.TaxTypeID = varTaxTypeID;
			
				item.StockLocation = varStockLocation;
			
				item.OurPrice = varOurPrice;
			
				item.RetailPrice = varRetailPrice;
			
				item.Weight = varWeight;
			
				item.CurrencyCode = varCurrencyCode;
			
				item.UnitOfMeasure = varUnitOfMeasure;
			
				item.AdminComments = varAdminComments;
			
				item.Length = varLength;
			
				item.Height = varHeight;
			
				item.Width = varWidth;
			
				item.DimensionUnit = varDimensionUnit;
			
				item.IsDeleted = varIsDeleted;
			
				item.ListOrder = varListOrder;
			
				item.RatingSum = varRatingSum;
			
				item.TotalRatingVotes = varTotalRatingVotes;
			
				item.DefaultImage = varDefaultImage;
			
				item.CreatedOn = varCreatedOn;
			
				item.CreatedBy = varCreatedBy;
			
				item.ModifiedOn = varModifiedOn;
			
				item.ModifiedBy = varModifiedBy;
			
			item.IsNew = false;
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}

		#endregion
        
        
        
        #region Typed Columns
        
        
        public static TableSchema.TableColumn ProductIDColumn
        {
            get { return Schema.Columns[0]; }

        }

        
        
        
        public static TableSchema.TableColumn SkuColumn
        {
            get { return Schema.Columns[1]; }

        }

        
        
        
        public static TableSchema.TableColumn ProductGUIDColumn
        {
            get { return Schema.Columns[2]; }

        }

        
        
        
        public static TableSchema.TableColumn ProductNameColumn
        {
            get { return Schema.Columns[3]; }

        }

        
        
        
        public static TableSchema.TableColumn ShortDescriptionColumn
        {
            get { return Schema.Columns[4]; }

        }

        
        
        
        public static TableSchema.TableColumn ManufacturerIDColumn
        {
            get { return Schema.Columns[5]; }

        }

        
        
        
        public static TableSchema.TableColumn AttributeXMLColumn
        {
            get { return Schema.Columns[6]; }

        }

        
        
        
        public static TableSchema.TableColumn StatusIDColumn
        {
            get { return Schema.Columns[7]; }

        }

        
        
        
        public static TableSchema.TableColumn ProductTypeIDColumn
        {
            get { return Schema.Columns[8]; }

        }

        
        
        
        public static TableSchema.TableColumn ShippingTypeIDColumn
        {
            get { return Schema.Columns[9]; }

        }

        
        
        
        public static TableSchema.TableColumn ShipEstimateIDColumn
        {
            get { return Schema.Columns[10]; }

        }

        
        
        
        public static TableSchema.TableColumn TaxTypeIDColumn
        {
            get { return Schema.Columns[11]; }

        }

        
        
        
        public static TableSchema.TableColumn StockLocationColumn
        {
            get { return Schema.Columns[12]; }

        }

        
        
        
        public static TableSchema.TableColumn OurPriceColumn
        {
            get { return Schema.Columns[13]; }

        }

        
        
        
        public static TableSchema.TableColumn RetailPriceColumn
        {
            get { return Schema.Columns[14]; }

        }

        
        
        
        public static TableSchema.TableColumn WeightColumn
        {
            get { return Schema.Columns[15]; }

        }

        
        
        
        public static TableSchema.TableColumn CurrencyCodeColumn
        {
            get { return Schema.Columns[16]; }

        }

        
        
        
        public static TableSchema.TableColumn UnitOfMeasureColumn
        {
            get { return Schema.Columns[17]; }

        }

        
        
        
        public static TableSchema.TableColumn AdminCommentsColumn
        {
            get { return Schema.Columns[18]; }

        }

        
        
        
        public static TableSchema.TableColumn LengthColumn
        {
            get { return Schema.Columns[19]; }

        }

        
        
        
        public static TableSchema.TableColumn HeightColumn
        {
            get { return Schema.Columns[20]; }

        }

        
        
        
        public static TableSchema.TableColumn WidthColumn
        {
            get { return Schema.Columns[21]; }

        }

        
        
        
        public static TableSchema.TableColumn DimensionUnitColumn
        {
            get { return Schema.Columns[22]; }

        }

        
        
        
        public static TableSchema.TableColumn IsDeletedColumn
        {
            get { return Schema.Columns[23]; }

        }

        
        
        
        public static TableSchema.TableColumn ListOrderColumn
        {
            get { return Schema.Columns[24]; }

        }

        
        
        
        public static TableSchema.TableColumn RatingSumColumn
        {
            get { return Schema.Columns[25]; }

        }

        
        
        
        public static TableSchema.TableColumn TotalRatingVotesColumn
        {
            get { return Schema.Columns[26]; }

        }

        
        
        
        public static TableSchema.TableColumn DefaultImageColumn
        {
            get { return Schema.Columns[27]; }

        }

        
        
        
        public static TableSchema.TableColumn CreatedOnColumn
        {
            get { return Schema.Columns[28]; }

        }

        
        
        
        public static TableSchema.TableColumn CreatedByColumn
        {
            get { return Schema.Columns[29]; }

        }

        
        
        
        public static TableSchema.TableColumn ModifiedOnColumn
        {
            get { return Schema.Columns[30]; }

        }

        
        
        
        public static TableSchema.TableColumn ModifiedByColumn
        {
            get { return Schema.Columns[31]; }

        }

        
        
        
        #endregion
		#region Columns Struct
		public struct Columns
		{
			 public static string ProductID = @"productID";
			 public static string Sku = @"sku";
			 public static string ProductGUID = @"productGUID";
			 public static string ProductName = @"productName";
			 public static string ShortDescription = @"shortDescription";
			 public static string ManufacturerID = @"manufacturerID";
			 public static string AttributeXML = @"attributeXML";
			 public static string StatusID = @"statusID";
			 public static string ProductTypeID = @"productTypeID";
			 public static string ShippingTypeID = @"shippingTypeID";
			 public static string ShipEstimateID = @"shipEstimateID";
			 public static string TaxTypeID = @"taxTypeID";
			 public static string StockLocation = @"stockLocation";
			 public static string OurPrice = @"ourPrice";
			 public static string RetailPrice = @"retailPrice";
			 public static string Weight = @"weight";
			 public static string CurrencyCode = @"currencyCode";
			 public static string UnitOfMeasure = @"unitOfMeasure";
			 public static string AdminComments = @"adminComments";
			 public static string Length = @"length";
			 public static string Height = @"height";
			 public static string Width = @"width";
			 public static string DimensionUnit = @"dimensionUnit";
			 public static string IsDeleted = @"isDeleted";
			 public static string ListOrder = @"listOrder";
			 public static string RatingSum = @"ratingSum";
			 public static string TotalRatingVotes = @"totalRatingVotes";
			 public static string DefaultImage = @"defaultImage";
			 public static string CreatedOn = @"createdOn";
			 public static string CreatedBy = @"createdBy";
			 public static string ModifiedOn = @"modifiedOn";
			 public static string ModifiedBy = @"modifiedBy";
						
		}

		#endregion
		
		
		
	}

}

